package com.dianping.cat.consumer.business.model.entity;

import com.dianping.cat.consumer.business.model.BaseEntity;
import com.dianping.cat.consumer.business.model.IVisitor;
import java.util.LinkedHashMap;
import java.util.Map;





public class BusinessItem
  extends BaseEntity<BusinessItem>
{
  private String m_id;
  private String m_type;
/*  17 */   private Map<Integer, Segment> m_segments = new LinkedHashMap();





/*  23 */   public BusinessItem(String id) { this.m_id = id; }




/*  28 */   public void accept(IVisitor visitor) { visitor.visitBusinessItem(this); }


  public BusinessItem addSegment(Segment segment) {
    this.m_segments.put(segment.getId(), segment);
/*  33 */     return this;
  }


  public boolean equals(Object obj) {
/*  38 */     if (obj instanceof BusinessItem) {
/*  39 */       BusinessItem _o = (BusinessItem)obj;

/*  41 */       if (!equals(getId(), _o.getId())) {
/*  42 */         return false;
      }

/*  45 */       return true;
    }

/*  48 */     return false;
  }


/*  52 */   public Segment findSegment(Integer id) { return (Segment)this.m_segments.get(id); }


  public Segment findOrCreateSegment(Integer id) {
/*  56 */     Segment segment = (Segment)this.m_segments.get(id);

/*  58 */     if (segment == null) {
/*  59 */       synchronized (this.m_segments) {
/*  60 */         segment = (Segment)this.m_segments.get(id);

/*  62 */         if (segment == null) {
/*  63 */           segment = new Segment(id);
/*  64 */           this.m_segments.put(id, segment);
        }
      }
    }

/*  69 */     return segment;
  }


/*  73 */   public String getId() { return this.m_id; }



/*  77 */   public Map<Integer, Segment> getSegments() { return this.m_segments; }



/*  81 */   public String getType() { return this.m_type; }





  public void mergeAttributes(BusinessItem other) {
/*  95 */     assertAttributeEquals(other, "business-item", "id", this.m_id, other.getId());

/*  97 */     if (other.getType() != null) {
/*  98 */       this.m_type = other.getType();
    }
  }


/* 103 */   public Segment removeSegment(Integer id) { return (Segment)this.m_segments.remove(id); }


  public BusinessItem setId(String id) {
/* 107 */     this.m_id = id;
/* 108 */     return this;
  }

  public BusinessItem setType(String type) {
/* 112 */     this.m_type = type;
/* 113 */     return this;
  }

  public BusinessItem() {}
}


/* Location:              /Users/hanfei/Documents/apache-tomcat-9.0.24/webapps/cat/WEB-INF/lib/cat-consumer-3.0.0.jar!/com/dianping/cat/consumer/business/model/entity/BusinessItem.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       1.0.7
 */